//
//  MBDGroupLogoCell.swift
//  MasterBoy
//
//  Created by kyson on 2024/8/27.
//

import Foundation
import SnapKit
import Kingfisher


class MBDGroupLogoCell : MBDCommonCell {
    var groupLogoImageView : UIImageView!

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        //暂不支持暗黑模式，所有背景颜色都写死
//        self.commonBackgroundView.backgroundColor = UIColor(colorHex: 0x4273d0)
//        self.contentView.backgroundColor = UIColor(colorHex: 0x4273d0)
        self.commonBackgroundView.setDynamicForgroundColor()
        self.contentView.setDynamicForgroundColor()
        
//        self.separateLine.backgroundColor = UIColor(colorHex: 0x4273d0)
        
        self.initialize()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        self.initialize()
    }
    
    override var cellModel: Any!{
        didSet {
            let realCellModel = self.cellModel as! MBDGroupLogoCellModel

            let url = URL(string: realCellModel.groupCoverURL)
            self.groupLogoImageView.kf.setImage(with: url)
        }
    }

    func initialize() {
        groupLogoImageView = UIImageView()
        self.contentView.addSubview(groupLogoImageView)
        groupLogoImageView.snp.makeConstraints { make in
            make.height.equalToSuperview()
            make.width.equalToSuperview()
        }
    }
}
